package com.jiang.service.impl;

import com.jiang.dao.BookDao;
import com.jiang.dao.impl.BookDaoImpl;
import com.jiang.service.BookService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class BookServiceImpl implements BookService, InitializingBean, DisposableBean {
//    删除业务层中使用new创建的dao对象
//    private BookDao bookDao = new BookDaoImpl();
    private BookDao bookDao;
    
    @Override
    public void save(){
        System.out.println("book service save...");
        bookDao.save();
    }
    
    //提供对应的set方法 
    public void setBookDao(BookDao bookDao){
        this.bookDao = bookDao;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("Service destory");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("Service init");
    }
}
